import requests

# 登录请求
# 接口地址http://localhost:8080/admin/employee/login
# post请求  请求数据类型json
dictA = {"password": "123456", "username": "admin"}
r = requests.post("http://localhost:8085/admin/employee/login", json=dictA)
print(r.json())
assert r.json()["msg"] == "success"
# 提取token值
print(r.json()["data"]["token"])
# 把token存到value中
value = r.json()["data"]["token"]

# 根据id查询员工信息
id = 2
#接口地址"http://localhost:8085/admin/employee/{id}"
# 请求方式get
# 返回数据格式json
# 传入token
headers = {"token": value}
u = requests.get("http://localhost:8085/admin/employee/2",headers=headers)
print(u.json())
